package ui;
import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.miginfocom.swing.MigLayout;
import javax.swing.JTable;
import javax.swing.JLabel;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;


public class home extends JFrame {

	private JPanel contentPane;
	private JTable table;
	private JTable table_1;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					home frame = new home();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public home() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 800, 600);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new MigLayout("", "[][grow][grow]", "[][grow]"));
		
		JLabel lblWhatsHot = new JLabel("Whats Hot");
		contentPane.add(lblWhatsHot, "cell 1 0");
		
		JLabel lblTopics = new JLabel("Topics");
		contentPane.add(lblTopics, "cell 2 0");
		
		Object[][] fakeDataWH = {
        	    {"Kathy", "Smith",
           	     "Snowboarding", new Integer(5), new Boolean(false)},
           	    {"John", "Doe",
           	     "Rowing", new Integer(3), new Boolean(true)},
           	    {"Sue", "Black",
           	     "Knitting", new Integer(2), new Boolean(false)},
           	    {"Jane", "White",
           	     "Speed reading", new Integer(20), new Boolean(true)},
           	    {"Joe", "Brown",
           	     "Pool", new Integer(10), new Boolean(false)}
           	};
		String[] columnNamesWH = {"Item",
                "etc",
                "etc",
                "etc",
                "etc"};
		
		
		table = new JTable(fakeDataWH,columnNamesWH);
		contentPane.add(table, "cell 1 1,grow");
		
		
		
		
		
		String[] columnNamesT = {"Item name",
                "etc",
                "etc",
                "etc",
                "etc"};
		
		Object[][] fakeDateT = {
			    {"Kathy", "Smith",
			     "Snowboarding", new Integer(5), new Boolean(false)},
			    {"John", "Doe",
			     "Rowing", new Integer(3), new Boolean(true)},
			    {"Sue", "Black",
			     "Knitting", new Integer(2), new Boolean(false)},
			    {"Jane", "White",
			     "Speed reading", new Integer(20), new Boolean(true)},
			    {"Joe", "Brown",
			     "Pool", new Integer(10), new Boolean(false)}
			};
		
		table_1 = new JTable(fakeDateT,columnNamesT);
		contentPane.add(table_1, "cell 2 1,grow");
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu mnHome = new JMenu("Home");
		menuBar.add(mnHome);
		
		JMenuItem mntmHome = new JMenuItem("Home");
		mnHome.add(mntmHome);
		
		JMenuItem mntmProfilePage = new JMenuItem("Profile Page");
		mnHome.add(mntmProfilePage);
		mntmProfilePage.addActionListener(
				new ActionListener(){
					public void actionPerformed(ActionEvent e)
					{
						user_page x = new user_page();
						x.setVisible(true);
						dispose();
					}

				}
			);
		
		JMenu mnSearchbrowse = new JMenu("Search/Browse");
		menuBar.add(mnSearchbrowse);
		
		JMenuItem mntmBrowse = new JMenuItem("Browse");
		mnSearchbrowse.add(mntmBrowse);
		
		JMenuItem mntmSearch = new JMenuItem("Search");
		mnSearchbrowse.add(mntmSearch);
		
		JMenu mnV = new JMenu("V");
		menuBar.add(mnV);
		
		JMenuItem mntmEditProfile = new JMenuItem("Edit Profile");
		mnV.add(mntmEditProfile);
		
		JMenuItem mntmLogOut = new JMenuItem("Log Out");
		mnV.add(mntmLogOut);
	}

}
